package class_wuziqi;

import java.io.IOException;
import java.io.Serializable;
import java.net.ServerSocket;
import java.net.Socket;

public class ServerThread implements Runnable,Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private ServerSocket server;
	private Socket socket;
	public ServerThread(ServerSocket server) {
		this.server = server;
	}
	
	@Override
	public void run() {
		while(true){
			System.out.println("服务器已启动，"+server.getLocalPort()+"等待对手中");
			try {
				socket=server.accept();
				ReceiveThread rt=new ReceiveThread(socket);
				new Thread(rt).start();
				MainPro.getInstance().isLinked=true;
				
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}
}
